package com.logistic.common.taglib;

import java.io.IOException;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import com.logistic.common.ApplicationContextHelper;
import com.logistic.domain.Integral;
import com.logistic.service.IntegralService;

public class AccoutIsEnough extends TagSupport{ 
	/**
	 * 
	 */
	private static final long serialVersionUID = 6290388793965694092L;

	private String wbUid;
	private String wbTotalMoney;


	public int doStartTag() { 
	  JspWriter out = pageContext.getOut();
	  String isEnough = "";
	  IntegralService integralService = (IntegralService)ApplicationContextHelper.getBean("integralService");
	  Integral in = new Integral();
	  in.setUid(wbUid);
	  in = integralService.getIntegralByUid(in);
	  Double totalMoney = Double.parseDouble(wbTotalMoney);
	  Double accoutMoney = Double.parseDouble(in.getaccoutMoney());
	  if(totalMoney <= accoutMoney)
	  {
		  isEnough =  "钱够啦!";
	  }else
	  {
		  isEnough = "N";
	  }
	  try {
		out.println(isEnough);
	} catch (IOException e) {
		e.printStackTrace();
	} 
	  return EVAL_PAGE;// 标签执行完后，继续执行后面的 
	}

	public int doEndTag() { 
		  return EVAL_PAGE; 
	} 
	

	public String getWbUid() {
		return wbUid;
	}
	public void setWbUid(String wbUid) {
		this.wbUid = wbUid;
	}
	public String getWbTotalMoney() {
		return wbTotalMoney;
	}

	public void setWbTotalMoney(String wbTotalMoney) {
		this.wbTotalMoney = wbTotalMoney;
	}

	
}
